<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.20"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Detail: service_tool.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Detail
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.20 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">service_tool.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="service__tool_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160; </div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment">// #ifndef service_tool_HPP</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment">// #define service_tool_HPP</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160; </div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160; </div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="keyword">namespace </span>guild_service {</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="keyword">namespace </span>common {</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160; </div>
<div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="classguild__service_1_1common_1_1service__tool.html">   34</a></span>&#160;<span class="keyword">class </span><a class="code" href="classguild__service_1_1common_1_1service__tool.html">service_tool</a> {</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;  <a class="code" href="classguild__service_1_1common_1_1service__tool.html">service_tool</a>() : user_count_(0) {}</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160; </div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;  <span class="keyword">virtual</span> ~<a class="code" href="classguild__service_1_1common_1_1service__tool.html">service_tool</a>() = <span class="keywordflow">default</span>;</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160; </div>
<div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="classguild__service_1_1common_1_1service__tool.html#a2031e4504dfb311eec63267d6a835318">   46</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classguild__service_1_1common_1_1service__tool.html#a2031e4504dfb311eec63267d6a835318">start</a>() {</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;    user_count_++;</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;  }</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160; </div>
<div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="classguild__service_1_1common_1_1service__tool.html#a8e1bb0c64cf1d7b93ac0152dea7fd4b6">   57</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classguild__service_1_1common_1_1service__tool.html#a8e1bb0c64cf1d7b93ac0152dea7fd4b6">stop</a>() {</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;    user_count_--;</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;  }</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160; </div>
<div class="line"><a name="l00068"></a><span class="lineno"><a class="line" href="classguild__service_1_1common_1_1service__tool.html#a6c3dffd097f9dbf068cfd7f7b3f405f1">   68</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classguild__service_1_1common_1_1service__tool.html#a6c3dffd097f9dbf068cfd7f7b3f405f1">started</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> user_count_ &gt; 0; }</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160; </div>
<div class="line"><a name="l00075"></a><span class="lineno"><a class="line" href="classguild__service_1_1common_1_1service__tool.html#a2428d690f9812ad121edd5d02650a6da">   75</a></span>&#160;  <span class="keywordtype">int</span> <a class="code" href="classguild__service_1_1common_1_1service__tool.html#a2428d690f9812ad121edd5d02650a6da">get_user_count</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> user_count_; }</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160; </div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;  <span class="keywordtype">int</span> user_count_;  </div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;};</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160; </div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;}  <span class="comment">// namespace common</span></div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;}  <span class="comment">// namespace guild_service</span></div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160; </div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;<span class="comment">// #endif  // service_tool_H</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aclassguild__service_1_1common_1_1service__tool_html"><div class="ttname"><a href="classguild__service_1_1common_1_1service__tool.html">guild_service::common::service_tool</a></div><div class="ttdoc">服务使用计数类</div><div class="ttdef"><b>Definition:</b> service_tool.hpp:34</div></div>
<div class="ttc" id="aclassguild__service_1_1common_1_1service__tool_html_a8e1bb0c64cf1d7b93ac0152dea7fd4b6"><div class="ttname"><a href="classguild__service_1_1common_1_1service__tool.html#a8e1bb0c64cf1d7b93ac0152dea7fd4b6">guild_service::common::service_tool::stop</a></div><div class="ttdeci">virtual bool stop()</div><div class="ttdef"><b>Definition:</b> service_tool.hpp:57</div></div>
<div class="ttc" id="aclassguild__service_1_1common_1_1service__tool_html_a2031e4504dfb311eec63267d6a835318"><div class="ttname"><a href="classguild__service_1_1common_1_1service__tool.html#a2031e4504dfb311eec63267d6a835318">guild_service::common::service_tool::start</a></div><div class="ttdeci">virtual bool start()</div><div class="ttdef"><b>Definition:</b> service_tool.hpp:46</div></div>
<div class="ttc" id="aclassguild__service_1_1common_1_1service__tool_html_a6c3dffd097f9dbf068cfd7f7b3f405f1"><div class="ttname"><a href="classguild__service_1_1common_1_1service__tool.html#a6c3dffd097f9dbf068cfd7f7b3f405f1">guild_service::common::service_tool::started</a></div><div class="ttdeci">bool started() const</div><div class="ttdef"><b>Definition:</b> service_tool.hpp:68</div></div>
<div class="ttc" id="aclassguild__service_1_1common_1_1service__tool_html_a2428d690f9812ad121edd5d02650a6da"><div class="ttname"><a href="classguild__service_1_1common_1_1service__tool.html#a2428d690f9812ad121edd5d02650a6da">guild_service::common::service_tool::get_user_count</a></div><div class="ttdeci">int get_user_count() const</div><div class="ttdoc">Get the user count object.</div><div class="ttdef"><b>Definition:</b> service_tool.hpp:75</div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="http://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.8.20
</small></address>
</body>
</html>
